import Vue from 'vue'
import VueRouter from 'vue-router'
import index from '../views/index/index.vue'
import login from '../views/login.vue'
import userlist from '../views/index/dataManage/userlist.vue'
import Blist from '../views/index/dataManage/Blist.vue'
import foodlist from '../views/index/dataManage/foodlist.vue'
import managerlist from '../views/index/dataManage/managerlist.vue'
import orderlist from '../views/index/dataManage/orderlist.vue'
import chart from '../views/index/chart/chart.vue'
import addGoods from '../views/index/addData/addGoods.vue'
import addStore from '../views/index/addData/addStore.vue'
import explain from '../views/index/explain/explain.vue'
import home from '../views/index/home.vue'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: login
  },
  {
    path: '/index',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/index/index.vue'),
	children: [
		{
			path:'',
			component: home,
			meta: [],
		},
		{
			path:'/userlist',
			component: userlist,
			meta: ['数据管理', '用户列表'],
		},
		{
			path:'/Blist',
			component: Blist,
			meta: ['数据管理', '商家列表'],
		},
		{
			path:'/foodlist',
			component: foodlist,
			meta: ['数据管理', '食品列表'],
		},
		{
			path:'/orderlist',
			component: orderlist,
			meta: ['数据管理', '订单列表'],
		},
		{
			path:'/managerlist',
			component: managerlist,
			meta: ['数据管理', '管理员列表'],
		},
		{
			path:'/addStore',
			component: addStore,
			meta: ['添加数据', '添加商铺'],
		},
		{
			path:'/addGoods',
			component: addGoods,
			meta: ['添加数据', '添加商品'],
		},
		{
			path:'/chart',
			component: chart,
			meta: ['图表', '用户分布'],
		},
		{
			path:'/explain',
			component: explain,
			meta: ['说明', '说明'],
		},
	],
  }
]

const router = new VueRouter({
  routes
})

export default router
